import unittest
import time
from HTMLTestRunnerX import HTMLTestRunner
from testcase.testcase import Baidu

if __name__ == '__main__':
    # 创建testsuit对象
    testsuit = unittest.TestSuite()
    # 创建加载器 加载测试用例
    tests = unittest.TestLoader().loadTestsFromTestCase(Baidu)
    # 将测试用例添加到测试套件中
    testsuit.addTests(tests)
    report_path = r'D:\File\workspace\Uiautomation\report'
    timer = time.strftime("%Y-%m-%d_%H_%M-%S")
    report_file = report_path + "\\" + timer + ".html"
    htmlTestRunner = HTMLTestRunner(stream = open(file=report_file,mode="wb"),
                                   title="用户测试报告",description="百度搜索自动化测试报告")
    htmlTestRunner.run(testsuit)

